package br.com.sales.hancadso.client.service;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import br.com.sales.generics.client.HanRequestBuilder;
import br.com.sales.generics.client.request.HannaRequestCallback;
import com.google.gwt.json.client.JSONArray;
import com.google.inject.Inject;
import java.util.Map;

/**
 *
 * @author v
 */
public class HanCadSOService {

    @Inject
    private HanRequestBuilder requestProxy;

    public void insertNewItem(Map fields, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(fields));

        requestProxy.sendRequest("HanCadSO", "insertNewItem", array, callback);
    }

    public void getDateGrid(Map items, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(items));

        requestProxy.sendRequest("HanCadSO", "getDateGrid", array, callback);
    }

    public void inactivate(Long sequence, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(sequence));

        requestProxy.sendRequest("HanCadSO", "inactivate", array, callback);
    }

    public void getDataSubItem(Long sequence, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(sequence));

        requestProxy.sendRequest("HanCadSO", "getDataSubItem", array, callback);
    }

    public void updateDateRequest(String field, Long sequence, HannaRequestCallback callback) {
        JSONArray array = new JSONArray();
        array.set(0, requestProxy.formatJson(field));
        array.set(1, requestProxy.formatJson(sequence));

        requestProxy.sendRequest("HanCadSO", "updateDateRequest", array, callback);
    }
}
